package com.lh.serverforwebrtc.controller;

import com.lh.serverforwebrtc.bean.RespBean;
import com.lh.serverforwebrtc.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Lh
 * @Description:
 * @Date: Created in 13:58 2022/6/10
 */
@RestController
@RequestMapping("room")
public class RoomController {

    @Autowired
    private RoomService roomService;

    @PostMapping(value = "createRoom")
    public RespBean createRoom(@RequestParam("id")String id){
        return roomService.createRoom(Long.valueOf(id));
    }

    @PostMapping(value = "joinRoom")
    public RespBean createRoom(@RequestParam("id")Long id,@RequestParam("roomId")Long roomId){
        return roomService.addRoom(Long.valueOf(id),Long.valueOf(roomId));
    }

    @PostMapping(value = "deleteRoom")
    public RespBean deleteRoom(@RequestParam("roomId")String roomId){
            return roomService.deleteRoom(Long.valueOf(roomId));
    }

        @PostMapping(value = "test")
        public String test(String name,String age) {
            return "asadasdsas:asajidsbasb";
    }
}
